
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>BBBBBBBBBBBBBBBBBBB</title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="stylesheet" href="https://static.9hive.cn/global/css/bootstrap-extend.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.css?v=1.1">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-select/bootstrap-select.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/mmenu/assets/css/site.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/fonts/font-awesome/font-awesome.min.css">
    <link href="https://static.9hive.cn/global/vendor/icheck/icheck.min.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/icheck/skins/flat/blue.css" rel="stylesheet">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/nprogress/nprogress.min.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/multi-select/multi-select.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/inside/inside.css?v=1">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/common/common_20170925.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/file/file.css" >
    <link rel="stylesheet" href="https://static.9hive.cn/global/iconhive/hiveicon.css">

    <!--[if lt IE 9]>
    <script src="https://static.9hive.cn/global/vendor/html5shiv/html5shiv.min.js"></script>
    <![endif]-->

    <!--[if lt IE 10]>
    <script src="https://static.9hive.cn/global/vendor/media-match/media.match.min.js"></script>
    <script src="https://static.9hive.cn/global/vendor/respond/respond.min.js?v=1.2.1"></script>
    <![endif]-->


    <link href="https://static.9hive.cn/global/vendor/icheck/skins/flat/blue.css" rel="stylesheet">
    <style>
        body .demo-class .layui-layer-btn .layui-layer-btn0 {
            background: #15baff;
        }

        .text {
            color: #eb2113;
            /* padding-top: 3px; */
            font-size: 13px;
            font-weight: bold;
        }

        .mbxsecond:hover {
            color: #337ab7;
        }

        /*不要删除*/
        .bootstrap-table {
            margin-top: -18px;
            padding-bottom:20px !important;
        }

        body .demo-class .layui-layer-btn .layui-layer-btn0 {
            background: #992730;
        }
        .control-label {
            width:120px;
            text-align: right!important;
        }
        .pagination {
            display: inline-block;
            padding-left: 0px;
            margin: 0px;
            border-radius: 4px;
        }
    </style>
</head>

<body>
<div class="ibox">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title">
            <span class="current">品牌用户</span>
            <span class="line">/</span>
            <span class="current"><a href="/mall/admin/SmsController/list">短信管理</a></span>
            <span class="line">/</span>
            群发短信
        </div>
    </div>

    <div class="ibox-content">
        <div class="row">
            <div class="col-sm-12">
                <form method="post" action="/mall/admin/SmsController/SendSms" class="form-horizontal form-validate">
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span class="maroon">*</span>添加用户</label>
                        <div class="col-sm-10">
                            <div id="toolbar" class="form-inline" style="margin-top: 15px;">
                                <button type="button" id="addStore" class="hive-btn">
                                    添加
                                </button>
                                <button type="button" id="delAllStore" class="hive-btn-delete">
                                    全部删除
                                </button>
                            </div>

                            <table id="_table" data-toggle="table" data-mobile-responsive="true"
                                   class="table table-bordered table-strip table-hovered">
                                <thead>
                                <tr>
                                   <!-- <th data-field="id">用户编号</th>-->
                                    <th data-field="username">用户名称</th>
                                  <!--  <th data-field="" data-formatter="locationFormatter">地址</th>-->
                                    <th data-field="phone">联系电话</th>
                                    <th data-formatter="opFormatter" data-halign="center"  data-align="center">操作</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                    <input type="hidden" name="staff.jac_status" value="0">
                    <div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span class="maroon">*</span>签名</label>
                        <div class="col-sm-3">
                            <input type="text" name="staff.content" value="有田有闲"
                                   class="form-control light-input" maxlength="15" data-rule-required="true">
                        </div>
                        <span class="help-block color_hint">不超过15个字符</span>
                    </div>
                    <input type="hidden" id="numOfSend" name="numOfSend" >
                    <input type="hidden" id="usernames" name="usernames" >
                    <input type="hidden" id="phones" name="phones" >
                    <div class="form-group">
                        <label class="col-sm-2 control-label"><span class="maroon">*</span>短信内容</label>
                        <div class="col-sm-3">
                            <input type="text" name="staff.account" value="" class="form-control light-input"
                                   maxlength="60" data-rule-required="true">
                            <input type="hidden" name="staff.id" value="">
                            <input type="hidden" name="deleIds">
                        </div>
                        <span class="help-block color_hint">不超过60个字符</span>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-7 col-sm-offset-5">
                            <button class="hive-btn-cancle" onclick="history.back()" type="button">取消</button>
                            <button class="hive-btn  hive-btn-primary margin-left-8" type="submit" onclick="return check()">发送短信</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>



<script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/bootstrap-table.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-export/bootstrap-export.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-table-1.11/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-export/jquery-export.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-select/bootstrap-select.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/multi-select/jquery.multi-select.js"></script>
<script src="https://static.9hive.cn/global/js/core.min.js"></script>
<script src="https://static.9hive.cn/mmenu/assets/js/site.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
<script src="https://static.9hive.cn/global/vendor/icheck/icheck.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/nprogress/nprogress.js"></script>
<!--<script src="https://static.9hive.cn/global/js/components/bootstrap-select.min.js"></script>-->
<!--<script src="https://static.9hive.cn/global/js/components/multi-select.min.js"></script>-->

<script src="https://static.9hive.cn/global/vendor/layer/laydate/laydate.js">

</script>

<script src="https://static.9hive.cn/global/vendor/jquery-validate/jquery.validate.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/additional-methods.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/localization/messages_zh.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-ajaxform/ajax-form.js"></script>
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>
<script type="text/javascript" src="https://static.9hive.cn/global/vendor/file/uploadify/ajaxfileupload.js" ></script>
<script type="text/javascript">
    var uploadUrl = "/card/file/uploadfile?shopId=4da05513b44a4762849c3fe32f792aa8&type=d";
    var browserUrl = "/card/file/browser?shopId=4da05513b44a4762849c3fe32f792aa8";
</script>
<script src="https://static.9hive.cn/global/vendor/file/file.js"></script>

<script type="text/javascript">
</script>
<script type="text/javascript">
    $('#addStore').on('click', function () {
        //parent.parent.layer.open({
        parent.layer.open({
            shade: [0.3, '#fff'],
            title: "添加用户",
            type: 2, move: false,  resize: false,
            area: ['830px', '630px'],
            skin: 'demo-class',
            btnAlign: 'c',
            shadeClose: true,
            content: ['/mall/admin/SmsController/poiPage', 'no'],
            btn: ['选择', '关闭'],
            success: function (layero, index) {
                //childBody =parent.parent.layer.getChildFrame('body', index);
                childBody = parent.layer.getChildFrame('body', index);
            },
            yes: function () {
                childBody.find('#button').click();
            },
            btn2: function () {
                // parent.parent.layer.closeAll();
                parent.layer.closeAll();
            }
        });

    });
    function check() {

        var storedata = $("#_table").bootstrapTable("getOptions").data;
        $('#numOfSend').val(storedata.length);  //storedata.length人数
        if (storedata.length == 0) {
            parent.layer.msg("请选择用户");
            return false;
        }

        var content = $("input[name='staff.content']").val();
        if (content == null || content == "") {
            parent.layer.msg("签名不能为空");
            return false;
        }
        var account = $("input[name='staff.account']").val();
        if (account == null || account == "") {
            parent.layer.msg("短信内容不能为空");
            return false;
        }

        //放到判断之后
        var html = "";
        var usernames="";
        var phones="";
        $.each(storedata, function (index, store) {
            var username = store.username;
            var phone = store.phone;
            usernames=usernames+username+",";
            phones=phones+phone+",";

        });
        $('#usernames').val(usernames);
        $('#phones').val(phones);
        //   html += "<input type='hidden' name='staffStore[" + index + "].username' value=" + aa + ">";
       // html += "<input type='hidden' name='staffStore[" + index + "].username' value=" + username + ">";
       // html += "<input type='hidden' name='staffStore[" + index + "].phone' value=" + phone + ">";
        $("form").append(html);




        var strdeleIds = deleIds.join("&");
        $("input[name='deleIds']").val(strdeleIds);
    }
    function receive(added) {
        $("#_table").bootstrapTable("append", added);
    }
    function locationFormatter(value, row, index) {
        var province = row.province;
        var city = row.city;
        var district = row.district;
        var address = row.address;
        var statusString = province + city + district + address;
        var _statusString = statusString;
        if (statusString.length > 17) {
            _statusString = statusString.substring(0, 15) + ". . .";
        }
        var html = '<span data-toggle="tooltip" data-placement="top" title="' + statusString + '">' + _statusString + '</span>';
        return html;
    }
    function opFormatter(value, row, index) {
        var html = '<a href="javascript:void(0)" onclick="del(\'' + row.id + '\');" style="color:#FC4A52"><i data-toggle="tooltip" style="margin-right:10px;margin-left:10px;font-size:20px" data-placement="top" title="删除" class="fa fa-trash-o"></i></a>';
        return html;
    }
    var deleIds = [];
    var storeIds = [];
    function del(id) {
        deleIds.push(id);
        storeIds = remove(storeIds, id);
        $("#_table").bootstrapTable("removeByUniqueId", id);
        $('.tooltip').remove();
    }
    $('#delAllStore').on('click', function () {
        var storedata = $("#_table").bootstrapTable("getOptions").data;
        $.each(storedata, function (index, store) {
            var storeId = store.id;
            storeIds = remove(storeIds, storeId);
            deleIds.push(storeId)
        });
        $("#_table").bootstrapTable("removeAll");

    });
    function addstoreId(id) {
        return storeIds.push(id);
    }
    (function () {
        $('#_table').bootstrapTable({
            //url: "getStore?clerk_id=",
            pagination: true,
            search: true,
            showRefresh: true,
            clickToSelect: true,
            maintainSelected: true,
            iconSize: 'outline',
            toolbar: '#toolbar',
            uniqueId: "id",
            pageSize: 5,
            formatRefresh: function () {
                return '刷新';
            },
            formatSearch: function () {
                return '输入用户名称或手机号';
            },
            formatNoMatches: function () {     var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';     return imghtml; },
            formatLoadingMessage: function () {  //数据加载中样式
                return ' <div id="loading"><div id="loading-center">' +
                    '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                    '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                    '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
            },
            icons: {
                refresh: 'icon-refresh',
                toggle: 'glyphicon-list-alt',
                columns: 'icon-select',
                export: 'icon-export'
            },
            responseHandler: function (res) {
                console.log(res);
                if (res.isOk) {
                    storeIds = res.storeIds;
                    return res.Store;
                }
            }
        });
        $(".row").tooltip({selector: "[data-toggle=tooltip]", container: "body"});
    })();
    //获取字符下标工具
    function index(array, val) {
        for (var i = 0; i < array.length; i++) {
            if (array[i] == val) return i;
        }
        return -1;
    }
    ;
    //删除数组元素工具
    function remove(array, val) {
        var index = this.index(array, val);
        if (index > -1) {
            array.splice(index, 1);
        }
        return array;
    }
    ;

</script>
</body>

</html>


